package com.yang.config;

import javax.sql.DataSource;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.alibaba.druid.pool.DruidDataSource;

//@EnableConfigurationProperties(JdbcProperties.class)//引入一个类
//@PropertySource("classpath:application.properties")
@Configuration
public class JdbcConfig2 {

	
	@Bean
	@ConfigurationProperties(prefix ="jdbc")//自动在Application.properties中寻找1以jdbc为前缀的属性，找到后如果有对应的set方法，就直接自动注入
	public DataSource datasource(){
		DruidDataSource datasource = new DruidDataSource();
		return  datasource;
	}
	
	
}
